import request from '@/utils/request'
import type { IResponse } from '../types'
interface IUploadResponseData {
  url: string
  size: number
}
enum API {
  UPLOAD_AVATAR_URL = '/upload/avatar'
}

export const uploadAvatarApi = (data: any) => {
  const url = API.UPLOAD_AVATAR_URL
  const headers = {
    'Content-Type': 'multipart/form-data'
  }
  return request<any, IResponse<IUploadResponseData>>({
    url,
    method: 'post',
    data,
    headers
  })
}
